import requests from '@/utis/request'

// 用户账号登录
export const userAccountLogin = (account, password)=>{
    return requests('/login', 'post', { account, password })
}
// 校验用户是否存在
export const userAccountCheck = (account) => {
    return requests('/register/check', 'get', { account })
  }
// 获取数据短信验证码
export const userMobileLoginMsg = (mobile) => {
    return requests('/login/code', 'get', { mobile })
  }
// 手机号登录
export const userMobileLogin = ({ mobile, code }) => {
    return requests('/login/code', 'post', { mobile, code })
  }
/**
 * 获取QQ完善信息的时候短信验证码
 * @param {String} mobile - 手机号
 * @returns promise
 */
 export const userQQPatchCode = (mobile) => {
  return requests('/register/code', 'get', { mobile })
}

/**
 * QQ登录-完善信息
 * @param {String} unionId - QQ唯一标识，openId
 * @param {String} mobile - 手机号
 * @param {String} code - 验证码
 * @param {String} account - 帐号
 * @param {String} password - 密码
 * @returns
 */
export const userQQPatchLogin = ({ unionId, mobile, code, account, password }) => {
  return requests(`/login/social/${unionId}/complement`, 'post', { unionId, mobile, code, account, password })
}
